home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 2.toast / pc / sample code / interapplication comm / moreosl / morenavigation / morenavigation.c next >
Encoding:
Text File  |  2000-06-23  |  1.8 KB  |  62 lines

  1. /*
  2.     File:        MoreNavigation.c
  3.  
  4.     Contains:    Basic Navigation services utilities functionality.
  5.  
  6.     Written by:    Quinn
  7.  
  8.     Copyright:    Copyright © 2000 by Apple Computer, Inc., all rights reserved.
  9.  
  10.                 You may incorporate this Apple sample source code into your program(s) without
  11.                 restriction. This Apple sample source code has been provided "AS IS" and the
  12.                 responsibility for its operation is yours. You are not permitted to redistribute
  13.                 this Apple sample source code as "Apple sample source code" after having made
  14.                 changes. If you're going to re-distribute the source, we require that you make
  15.                 it clear in the source that the code was descended from Apple sample source
  16.                 code, but that you've made changes.
  17.  
  18.     Change History (most recent first):
  19.  
  20.          <1>     20/3/00    Quinn   First checked in.
  21. */
  22.  
  23. /////////////////////////////////////////////////////////////////
  24.  
  25. // MoreIsBetter Setup
  26.  
  27. #include "MoreSetup.h"
  28.  
  29. // Our Prototypes
  30.  
  31. #include "MoreNavigation.h"
  32.  
  33. // Mac OS Interfaces
  34.  
  35. #include <Resources.h>
  36.  
  37. // MIB Prototypes
  38.  
  39. /////////////////////////////////////////////////////////////////
  40.  
  41. extern pascal OSStatus MoreNavExtractSingleReply(const NavReplyRecord *reply, FSSpec *target)
  42.     // See comment in header.
  43. {
  44.     OSStatus err;
  45.     #if MORE_DEBUG
  46.         SInt32 selectionCount;
  47.     #endif
  48.     AEKeyword junkKeyword;
  49.     DescType  junkType;
  50.     Size      junkSize;
  51.  
  52.     MoreAssertQ((AECountItems(&reply->selection, &selectionCount) == noErr) && (selectionCount == 1));
  53.     err = AEGetNthPtr(&reply->selection, 1, typeFSS, &junkKeyword, &junkType, target, sizeof(*target), &junkSize);
  54.     if (err == noErr) {
  55.         MoreAssertQ(junkType == typeFSS && junkSize == sizeof(FSSpec));
  56.         if (target->name[0] == 0) {
  57.             err = FSMakeFSSpec(target->vRefNum, target->parID, target->name, target);    // Guard against potential Nav braindeadedness.
  58.         }
  59.     }
  60.     return err;
  61. }
  62.